package com.humble.humbleojcommon.utils;

import java.math.BigInteger;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

public class MD5Util {
    private static MessageDigest md;
    static {
        try {
            md = MessageDigest.getInstance("MD5");
        } catch (NoSuchAlgorithmException e) {
            throw new RuntimeException(e);
        }
    }
    public static String strToMD5(String str){
        byte[] digest = md.digest(str.getBytes());
        return new BigInteger(1,digest).toString();
    }
}
